<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

<h:head>

	<title>Search Personalized Packet</title>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<link href="../../style/style.css" rel="stylesheet" type="text/css" />

</h:head>

<h:body>

	<div class="main">

		<div class="header">

			<div class="header_resize">

				<div class="menu">

					<ul>

						<li><a href="../index.xhtml"><span>Home</span></a></li>

						<li><a href="../packet/packet.xhtml" class="active"><span>Travel
									Packet</span></a></li>

					</ul>

				</div>

			</div>

		</div>

		<div class="body">

			<div class="body_resize">

				<div class="left">

					<h2>
						Search <span>Personalized Packet</span>
					</h2>

					<h:form>


						<p:commandButton value="Search Personalized Packet"
							action="#{personalizedPacketBean.find}"
							update="personalizedPacketList" />



						<p:dataTable id="personalizedPacketList" var="pp"
							value="#{personalizedPacketBean.personalizedPacketList}"
							rowKey="#{pp.id_personalized_packet}"
							selection="#{personalizedPacketBean.personalizedPacket}"
							selectionMode="single">

							<f:facet name="header">  
            Select a packet  
        </f:facet>

							<p:column headerText="Id">  
            #{pp.id_personalized_packet}  
        </p:column>

							<p:column headerText="Email">  
            #{pp.user.email}  
        </p:column>

							<p:column headerText="Città">  
            #{pp.hotel.destination}  
        </p:column>

							<p:column headerText="Hotel">  
            #{pp.hotel.name}  
        </p:column>

						</p:dataTable>
						<br />
						<p:commandButton value="Delete Packet"
							action="#{personalizedPacketBean.delete}" />
						<p:commandButton value="Show Excursion" update="excursionList" />
						<br />
						<p:dataTable id="excursionList" var="excursion"
							value="#{personalizedPacketBean.personalizedPacket.excursions}">
							<p:column headerText="Name">
								<h:outputText value="#{excursion.name}" />
							</p:column>

							<p:column headerText="Info">
								<h:outputText value="#{excursion.info}" />
							</p:column>


						</p:dataTable>
						<br />
						<p:commandButton value="Buy it"
							action="#{personalizedPacketBean.buyIt()}" />
						<br />
						<h:outputLabel for="name">Email:</h:outputLabel>
						<p:inputText id="name" value="#{personalizedPacketBean.email}" />
						<p:commandButton value="Invite"
							action="#{personalizedPacketBean.invite()}" update="name" />

					</h:form>

					<br /> <br />

					<p:commandButton value="Show Total Price"
						action="#{personalizedPacketBean.calculatePacketPrice()}"
						update="price" />
					<h:outputLabel>  Price:  </h:outputLabel>
					<h:outputLabel id="price"
						value="#{personalizedPacketBean.totalPrice}" />

					<br /> <br />

					<h:link outcome="packet" value="back" />

				</div>

				<div class="right">

					<h2>
						Sidebar<span> Menu</span>
					</h2>

					<ul>

						<li><a href="#"> Home</a></li>

						<li><a href="#">Most boughted</a></li>

						<li><a href="#">Top destinations</a></li>

					</ul>

				</div>

				<div class="clr"></div>

			</div>

		</div>

		<div class="footer">

			<div class="footer_resize">

				<p>TravelDream</p>

			</div>

			<div class="clr"></div>

		</div>

	</div>

</h:body>

</html>